﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 多态
{
    class BasePlusCommissionEmployee:CommissionEmployee
    {
        private decimal baseSalary;

        public BasePlusCommissionEmployee(string first, string last, string num, decimal rate, decimal gross, decimal bs)
            : base(first, last, num, rate, gross)
        {
            BaseSalary = bs;
        }

        public override string ToString()
        {
            return string.Format("{0}\nbase salary: {1}", base.ToString(), BaseSalary);
        }

        public override decimal Earning()
        {
            return BaseSalary + base.Earning();
        }

        public decimal BaseSalary
        {
            get
            {
                return baseSalary;
            }
            set
            {
                baseSalary = (value > 0) ? value : 0;
            }
        }
    }//end class
}
